package main

import (
	"log"
	"math/rand"
	"runtime"
	"time"
)

func SayGreetings(greeting string, times int) {
	for i := 0; i < times; i++ {
		time.Sleep(2 * time.Second) // 睡眠2秒
		log.Println(greeting)
	}
}

func main() {
	rand.Seed(time.Now().UnixNano())
	log.SetFlags(11)
	go SayGreetings("hi!", 10)
	go SayGreetings("hello!", 10)

	log.Println(runtime.NumCPU())
	log.Println(runtime.NumGoroutine())
	time.Sleep(7 * time.Second)

}
